﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class NoticeMgr : BaseSingltonMono<NoticeMgr>
{
    public Text text;
    public Transform content;
    public GameObject ItemPrefab;
    public ModifyDialog modify;
    protected override void AwakeInit()
    {
        gameObject.SetActive(false);
    }

    public void OnCloseClick()
    {
        gameObject.SetActive(false);
    }


    public void Show(AccountElement element)
    {
        for (int i = 0; i < content.childCount; i++)
        {
            Destroy(content.GetChild(i).gameObject);
        }

        gameObject.SetActive(true);
        for (int i = 0; i < element.Accounts.Count; i++)
        {
            GameObject itemobj = Instantiate(ItemPrefab, content);
            ACItem item = itemobj.GetComponent<ACItem>();
            item.showitem(element.Key, element.Accounts[i]);
        }

    }


    public void ShowModifyDialog(ACItem item)
    {
        modify.ShowModifyDialog(item);
    }



}
